<script setup lang="ts">
import { ref } from "vue";
import { MESSAGE_TYPE } from "@/IM/constant";
const emit = defineEmits(["onStartLoading", "onLoadending"]);
import saveMsg from "../../utils/saveMsg.js";
const dialogTableVisible = ref(false);
const sendDicker = () => {
  dialogTableVisible.value = false;
  sendDickerMessage();
};
let num = ref();
let title = ref<String>('');
const sendDickerMessage = () => {
  let customEvent = "customEvent";
  let customExts = {
    price: num.value.toFixed(2),
    info: title.value,
    type: "dicker"
  };
  let options = {
    customEvent,
    customExts
  };
  saveMsg(options, MESSAGE_TYPE.CUSTOM);
  dialogTableVisible.value = false;
};
const showDickerDialog = (val, info) => {
  console.log(val,info)
  num.value = val;
  title.value = info;
  dialogTableVisible.value = true;
};
defineExpose({
  showDickerDialog
});
</script>
<template>
  <el-dialog v-model="dialogTableVisible" title="回复价格" width="300px">
    <el-input-number v-model="num" :precision="0" :step="1" :max="9999999" :min="0" style="width: 100%" />
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="dialogTableVisible = false">取消</el-button>
        <el-button type="primary" @click="sendDicker"> 发送 </el-button>
      </span>
    </template>
  </el-dialog>
</template>

<style lang="scss" scoped></style>
